#ifndef SMARTPOINTER_H
#define SMARTPOINTER_H

#include "HuntEngineSystem.h"
#include "ObjectSystemHeader.h"

template <class T> T* StaticCast ( Object* pObj )
{
	return (T*)pObj;
}

template <class T> const T* StaticCast ( const Object* pObj )
{
	return (const T*)pObj;
}

template <class T> T* DynamicCast ( Object* pObj )
{
	return pObj
		&& pObj->IsDerived(T::TYPE) ? (T*)pObj : NULL;
}

template <class T> const T* DynamicCast ( const Object* pObj )
{
	return pObj
		&& pObj->IsDerived(T::TYPE) ? (const T*)pObj : NULL;
}

template <class T> class Pointer
{
public:
	// constructor
	Pointer ( T* pObject = NULL );
	Pointer ( const Pointer& rPointer );
	~Pointer ();

	// implicit conversions
	operator T* () const;
	T& operator* () const;
	T* operator-> () const;

	// assignment
	Pointer& operator= ( T* pObject );
	Pointer& operator= ( const Pointer& rReference );

	// comparisons
	bool operator== ( T* pObject ) const;
	bool operator!= ( T* pObject ) const;
	bool operator== ( const Pointer<T>& rReference ) const;
	bool operator!= ( const Pointer<T>& rReference ) const;

protected:
	// the shared object
	T* m_pObject;
};


//#include "HuntEngineSystem.h"

//#include "Rtti.h"

#endif